package giab.weixin.web.httpimpl;

import giab.weixin.web.httpservice.HttpBaseService;
import giab.weixin.web.xml.bean.CustomerOrder;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component 
public class CustomerHttpImpl {
	@Autowired
	private HttpBaseService hbs;
	
	/**
	* @author 张怡菲
	* @createTime 	2013-5-7 下午3:17:10
	* @Title: customerSave
	* @Description: 用户预约接口
	* @param order
	* @return    String
	* @modifyTime	2013-5-7 下午3:17:10
	* @version 0.1
	* 
	*/
	
	public String customerSave(CustomerOrder order){
		//customer!save.action
		ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
		param.add(new BasicNameValuePair("weixinId", order.getWeixinId()));
		param.add(new BasicNameValuePair("reserType", order.getReserType()));
		param.add(new BasicNameValuePair("flightNumber", order.getFlightNumber()));
		param.add(new BasicNameValuePair("startAddress", order.getStartAddress()));
		param.add(new BasicNameValuePair("endAddress", order.getEndAddress()));
		param.add(new BasicNameValuePair("useDate", order.getUseDate()));
		param.add(new BasicNameValuePair("carType", order.getCarType()));
		param.add(new BasicNameValuePair("mobile", order.getMobile()));
		param.add(new BasicNameValuePair("cityId", order.getCityId()));
		String ru = hbs.postUrlResult("customer!save.action", param);		
		return ru;
	}
	
	/**
	* @author 张怡菲
	* @createTime 	2013-5-7 下午3:23:06
	* @Title: customerCancel
	* @Description: 
	* @param orderSubld
	* @return    String
	* @modifyTime	2013-5-7 下午3:23:06
	* @modifyNote (在这里说明修改了什么)
	* 
	*/
	
	public String customerCancel(String orderSubld){
		ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
		param.add(new BasicNameValuePair("orderSubld", orderSubld));
		String ru = hbs.postUrlResult("customer!cancel.action", param);		
		return ru;		
	}
	
	
	/**
	* @author 张怡菲
	* @createTime 	2013-5-7 下午3:30:05
	* @Title: customerUpdateOrder
	* @Description: 更新用户订单信息
	* @param order
	* @return    String
	* @modifyTime	2013-5-7 下午3:30:05
	* @modifyNote (在这里说明修改了什么)
	* 
	*/
	
	public String customerUpdateOrder(CustomerOrder order){
		ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
		param.add(new BasicNameValuePair("orderSubId", order.getOrderSubId()));
		param.add(new BasicNameValuePair("weixinId", order.getWeixinId()));
		param.add(new BasicNameValuePair("reserType", order.getReserType()));
		param.add(new BasicNameValuePair("flightNumber", order.getFlightNumber()));
		param.add(new BasicNameValuePair("startAddress", order.getStartAddress()));
		param.add(new BasicNameValuePair("endAddress", order.getEndAddress()));
		param.add(new BasicNameValuePair("useDate", order.getUseDate()));
		param.add(new BasicNameValuePair("carType", order.getCarType()));
		param.add(new BasicNameValuePair("mobile", order.getMobile()));
		param.add(new BasicNameValuePair("cityId", order.getCityId()));
		String ru = hbs.postUrlResult("customer!updateOrder.action", param);	
		return ru;
	}
	
	
	

}
